<!DOCTYPE html>
<script src="../../resources/js-test.js"></script>
<body>
  <div id="testelm">The test element<div>
<script>
  var testElm = document.getElementById("testelm");
  testElm.addEventListener("mousemove", function(event) {
      if (event.defaultPrevented) {
          testFailed("Mouse event already cancelled.");
          return;
      }
      event.preventDefault();
      if (!event.defaultPrevented) {
          testFailed("Mouse event not cancellable.");
          return;
      }
      testPassed("Mouse move event cancellable.")
  }, false);
  if ("eventSender" in window) {
      eventSender.mouseMoveTo(testElm.offsetLeft + testElm.offsetWidth / 3,
                              testElm.offsetTop + testElm.offsetHeight / 2);
      eventSender.mouseMoveTo(testElm.offsetLeft + testElm.offsetWidth / 3 * 2,
                              testElm.offsetTop + testElm.offsetHeight / 2);
  }
  else {
      testElm.innerHTML = "window.eventSender not available. To test move the mouse on top of this text.";
  }
</script>
</body>
